Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms

Public Class FrmCrPXUAT_TruyVet_sanPham_KH
    Private Tungay, Denngay, makh, tenkh As String
    Private customerReport As ReportDocument

    Private Sub FrmCrPXUAT_TruyVet_sanPham_KH_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        frmLoading.Show()
        Dim sqlQuery As String = "SELECT t1.ma_chungtu,t1.ngay_chungtu,t2.loaixuat as loai,t3.ma_hanghoa as ma_phu,t3.ten_bietduoc as ten_nhacungcap,t2.solo as vat,t2.soluongle as thanhtien FROM (tbl_xuat_hanghoa as t1 INNER JOIN  tbl_xuat_chitiet_hanghoa as t2 ON t1.ma_chungtu=t2.ma_chungtu )LEFT JOIN tbl_hanghoa as t3 ON t2.ma_hanghoa=t3.ma_hanghoa  WHERE  t1.ma_phu='" & makh & "' AND t1.ngay_chungtu BETWEEN '" & Format(CDate(Tungay), "yyyy-MM-dd") & "' AND '" & Format(CDate(Denngay), "yyyy-MM-dd") & "'   "
        Dim reportPath = Application.StartupPath & "\" & "crPXUAT_TruyVet_SanPham_KH.rpt"
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        customerReport.SetParameterValue("TTungay", Tungay)
        customerReport.SetParameterValue("TDenngay", Denngay)
        customerReport.SetParameterValue("TMakh", makh)
        customerReport.SetParameterValue("TTenkh", tenkh)
        customerReport.SetParameterValue("company", globalVariale.COMPANY)
        customerReport.SetParameterValue("address", globalVariale.ADDRESS)
        Me.CrNXTTongHopview.ReportSource = customerReport
        frmLoading.Close()
        frmLoading.Dispose()
    End Sub
    Public Sub setTungay(ByVal s As String)
        Tungay = s
    End Sub

    Public Sub setDenngay(ByVal s As String)
        Denngay = s
    End Sub

    Public Sub setMakh(ByVal s As String)
        makh = s
    End Sub
    Public Sub setTenkh(ByVal s As String)
        tenkh = s
    End Sub

End Class
